home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Amiga Format CD 38
/
Amiga Format CD38 (1999-03-15)(Future Publishing)(GB)(Track 1 of 3)[!][issue 1999-04].iso
/
-seriously_amiga-
/
programming
/
other
/
hrtmon
/
src
/
whdload.s
< prev
Wrap
Text File
|
1999-01-29
|
3KB
|
159 lines
;
; this file contains all whdload related commands
;
IFND WHDLOAD_I
TDREASON_OK = -1
resload_Abort = 4
resload_LoadFile = 8
resload_SaveFile = 12
resload_SetCACR = 16
resload_ListFiles = 20
resload_Decrunch = 24
resload_LoadFileDecrunch = 28
resload_FlushCache = 32
resload_GetFileSize = 36
resload_DiskLoad = 40
resload_DiskLoadDev = 44
resload_CRC16 = 48
resload_Control = 52
resload_SaveFileOffset = 56
resload_ProtectRead = 60
resload_ProtectReadWrite = 64
resload_ProtectWrite = 68
resload_ProtectRemove = 72
resload_LoadFileOffset = 76
resload_Relocate = 80
resload_Delay = 84
resload_DeleteFile = 86
ENDC
;---------------
; command WS - save memory region using resload_SaveFile
; (the same as command S but via WHDLoad)
;
cmd_ws tst.l (whd_base)
beq w_notinwhdload
lea ev_line,a1
bsr read_name
tst.b (a1)
beq illegal_name
bsr evaluate
bne illegal_addr
move.l d0,d4 ;d4=save start
bsr evaluate
bne illegal_addr
sub.l d4,d0 ;d0=save len
ble illegal_addr ;end must be > start
jsr remove_pic
move.l a1,a0 ;name
move.l d4,a1 ;address
move.l (whd_base),a2
jsr (resload_SaveFile,a2)
jsr set_pic
tst.l d0 ;only for the case that
;WHDL_NoError is not active
beq w_resloaderr
bra w_success
;---------------
; command WQ - quit WHDLoad
cmd_wq move.l (whd_base),d0
beq w_notinwhdload
sf entered
sf no_curs
pea TDREASON_OK
move.l d0,a2
jmp (resload_Abort,a2)
;---------------
; command WPR - protect memory region from reading
cmd_wpr tst.l (whd_base)
beq w_notinwhdload
bsr evaluate
bne illegal_addr
move.l d0,d4 ;d4 = address
bsr evaluate
bne illegal_addr
move.l d0,d5 ;d5 = length
move.l d5,d0
move.l d4,a0
move.l (whd_base),a2
jsr (resload_ProtectRead,a2)
bra w_success
;---------------
; command WPRW - protect memory region from reading and writing
cmd_wprw tst.l (whd_base)
beq w_notinwhdload
bsr evaluate
bne illegal_addr
move.l d0,d4 ;d4 = address
bsr evaluate
bne illegal_addr
move.l d0,d5 ;d5 = length
move.l d5,d0
move.l d4,a0
move.l (whd_base),a2
jsr (resload_ProtectReadWrite,a2)
bra w_success
;---------------
; command WPW - protect memory region from writing
cmd_wpw tst.l (whd_base)
beq w_notinwhdload
bsr evaluate
bne illegal_addr
move.l d0,d4 ;d4 = address
bsr evaluate
bne illegal_addr
move.l d0,d5 ;d5 = length
move.l d5,d0
move.l d4,a0
move.l (whd_base),a2
jsr (resload_ProtectWrite,a2)
bra w_success
;---------------
w_success lea (w_txt_success,pc),a0
bra w_printreturn
w_notinwhdload lea (w_txt_notinwhdload,pc),a0
bra w_printreturn
w_resloaderr lea (w_txt_resloaderr,pc),a0
w_printreturn pea (end_command)
bra print
w_txt_success dc.b "success",10,0
w_txt_resloaderr dc.b "error, resload function failed",10,0
w_txt_notinwhdload dc.b "error, whdload not active or old whdload version",10,0
EVEN